package com.luoye.lj.wstool.wsdm;

import com.luoye.lj.wstool.generator.ICodeGenerator;
import com.luoye.lj.wstool.wsdm.entity.WsdtEntity;
import com.luoye.lj.wstool.wsdm.entity.WsdtField;

/*
 * Created with IntelliJ IDEA.
 * User: Dave Liu
 * Date: 2016/7/7
 * Time: 15:45
 * To change this template use File | Settings | File Templates.
 */
public class HtmlExportFieldsForSelectCodeGenerator implements ICodeGenerator {
    private WsdtEntity wsdtEntity;

    public HtmlExportFieldsForSelectCodeGenerator(WsdtEntity wsdtEntity) {
        this.wsdtEntity = wsdtEntity;
    }

    @Override
    public String codeGenerate() {
        String code="";
        int i=0;
        if(this.wsdtEntity!=null){
            if(this.wsdtEntity.getFieldList()!=null){
                for(WsdtField wsdtField:this.wsdtEntity.getFieldList()){
                    i++;
                    code+="                    <div class=\"form-check\" style=\"height: 30px;float: left;width: 50%;\">\n" +
                            "                        <input type=\"checkbox\" name=\"export_field\" data-ef=\""+wsdtField.getFieldName()+"\" class=\"form-check-input\" checked=\"\" style=\"height: 30px;width: 15px;\">\n" +
                            "                        <label class=\"form-check-label\" style=\"line-height: 40px\">"+i+"."+wsdtField.getDescription()+"</label>\n" +
                            "                    </div>\n";
                }
            }
        }
        return code;
    }
}
